#define _CRT_SECURE_NO_WARNINGS
#include<string>
#include<iostream>
using namespace std;
class Solution {
public:
    int firstUniqChar(string s) {
        int array[26] = { 0 };
        for (auto e : s)
        {
            array[e - 'a']++;
        }
        for (int i = 0; i < s.size(); i++)
        {
            if (array[s[i] - 'a'] == 1)
            {
                return i;
            }
        }
        return -1;
    }
};
int main()
{
    string S1("leetcode");
    Solution s;
    cout << s.firstUniqChar(S1) << endl;
    return 0;
}
